package com.cn.controller;

import com.cn.entity.Usr;
import com.cn.service.UsrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

@RequestMapping()
@Controller
public class UsrController {
    @Autowired
    private UsrService usrService;
    @ResponseBody
    @GetMapping("hi")
    public String getUsr(){
         Usr u =usrService.getusr();
         System.out.println(u);
        return "HELLO  ======   wwwwwwwww"; // 成功返回 保存后的 demo
    }
    public Map Auth(Long time,String id,String token,String type){
            Map map = new HashMap();
            Long curTime =System.currentTimeMillis();

            if(type=="1"){//如果是查询类型 只校验 时间超时  token存在
                if(time>curTime ||"".equals(token)){
                    //token超时 token失效 重新登陆

                }else{
                    ////////next
                }
            } else{
                if(time>curTime ||"".equals(token)){
                    //token超时 token失效 重新登陆

                }else {
                    ////////校验token的真确性
                    if(1==1){
                        //next
                    }
                }
            }

        return null;
    }

    public String  encryption(Long time,String id,String token,String code){
        String secretKey="2fd312e6-9239-4f95-82f6-fe3191e10dae";

        return "";
    }
    public String  decrypt(){
        return "";
    }
}
